using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace RSSRadio
{
	class WinApi
	{
		[DllImport("CoreDll")] 
		public static extern IntPtr FindWindow(char[] className, char[] windowName); 
		[DllImport("CoreDll")] 
		public static extern IntPtr PostMessage(IntPtr hWnd, int msg, int wParam, 
		int lParam);
        [DllImport("CoreDll")]
        public static extern void SystemIdleTimerReset();


		public static void CloseMediaPlayer()
		{
			IntPtr Hwnd = FindWindow(null, "Windows Media".ToCharArray());
			//wm_user = 0x400; 
			//wmp_stop = 31756; 
			int x = 0x0400 + 31756;
			PostMessage(Hwnd, 0x0110/*WM_COMMAND*/, x, 0);
			PostMessage(Hwnd, 0x0010/*WM_CLOSE*/, 0, 0);
		}
	}
}
